<template>
  <div class="register-success-dialog" v-if="visible">
    <div class="dialog-card">
      <div class="dialog-header">
        <span class="icon-success">
          <img src="@/assets/icon/icon_success.svg" alt="">
        </span>
        <span class="title">取号成功</span>
      </div>
      <div class="dialog-info">
        <div class="info-row">
          <span class="label">科室：</span>
          <span class="value">{{ dept }}</span>
        </div>
        <div class="info-row">
          <span class="label">医生：</span>
          <span class="value">{{ doctor }}</span>
        </div>
        <div class="info-row">
          <span class="label">时间：</span>
          <span class="value">{{ time }}</span>
        </div>
      </div>
      <div class="dialog-actions">
        <button class="btn-cancel" @click="onClose">关闭</button>
        <button class="btn-pay" @click="onPay" v-if="payStatus == '1'" >收费 ￥{{  (Number( (Number(fee ) / 100))).toFixed(2) }}</button>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, defineProps, defineEmits } from 'vue'

const props = defineProps({
  visible: Boolean,
  dept: { type: String, default: '' },
  doctor: { type: String, default: '' },
  time: { type: String, default: '' },
  fee: { type: [String, Number], default: '0.00' },
  payStatus: { type: String, default: '' }, // '0' 未支付, '1' 已支付 '2' 部分支付, '3' 全额支付
})
const emits = defineEmits(['close', 'pay'])

const onClose=()=> {
  emits('close')
}
const onPay=()=> {
  emits('pay')
}
</script>

<style scoped>
.register-success-dialog {
  position: fixed;
  left: 0; right: 0; top: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dialog-card {
  background: #fff;
  border-radius: 16px;
  min-width: 340px;
  padding: 24px 28px 18px 28px;
  box-shadow: 0 4px 24px 0 rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.dialog-header {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
.icon-success {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  position: relative;
}
.icon-success::before {
  content: '';
  display: block;
  width: 10px;
  height: 10px;

  transform: rotate(-45deg);
  position: absolute;
  left: 5px;
  top: 3px;
}
.title {
  font-size: 18px;
  font-weight: 600;
  color: #222;
}
.dialog-info {
  margin-bottom: 18px;
  width: 100%;
}
.info-row {
  display: flex;
  font-size: 15px;
  color: #666;
  margin-bottom: 4px;
}
.label {
  color: #999;
  min-width: 48px;
  text-align: right;
}
.value {
  color: #333;
  margin-left: 4px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  gap: 12px;
}
.btn-cancel {
  background: #fff;
  border: 1px solid #d9d9d9;
  color: #666;
  border-radius: 6px;
  padding: 6px 18px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-cancel:hover {
  background: #f5f5f5;
}
.btn-pay {
background: #16ADA4;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 18px;
  font-size: 15px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.2s;
}
.btn-pay:hover {
  background: #139999;
}
</style>
